<?php
declare (strict_types = 1);

namespace app\api\validate;

use think\Validate;

class Login extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名' =>  ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'username' => 'require|min:3|max:10',
        'password' => 'require|min:6|max:12',
        'code' => 'require|length:4'
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名' =>  '错误信息'
     *
     * @var array
     */
    protected $message = [
        'username.require' => '用户名必填',
        'username.min' => '用户名最少3位',
        'username.max' => '用户名最多10位',
        'password.require' => '密码必填',
        'password.min' => '密码最少6位',
        'password.max' => '密码最多12位',
        'code.require' => "验证码必填",
        'code.length' => "验证码长度只能是4位"
    ];
}
